<!--
 @Author: libing/makeup1122
 @Email: makeup1123@163.com
 @Date: "2020-03-03 00:38:00"
-->
<template>
  <v-menu offset-y v-model="updateMenu" :close-on-content-click="false">
    <template v-slot:activator="{ on }">
      <v-btn v-on="on" icon :loading="updateLoading" small color="secondary"><v-icon small>edit</v-icon></v-btn>
    </template>
    <v-card>
      <v-card-title>修改标签名称</v-card-title>
      <v-card-text>
        <v-text-field :loading="updateLoading" required v-model="updateName" placeholder="输入标签名称"></v-text-field>
      </v-card-text>
      <v-card-actions>
        <v-btn color="primary" @click="updateHandle">确定</v-btn>
        <v-btn @click="updateMenu = false;">取消</v-btn>
      </v-card-actions>
    </v-card>
  </v-menu>
</template>
<script>
export default {
  name: 'WxMemberTagsEdit',
  components: {},
  props: {
    item: {
      type: Object,
      required: true
    }
  },
  data: function () {
    return {
      updateMenu: false,
      updateLoading: false,
      updateName: this.item.name
    }
  },
  created: function () {

  },
  computed: {},
  methods: {
    updateHandle: function() {
      this.$store.dispatch('updateTag', { id: this.item.id, name: this.updateName }).then(res => {
        this.$toasted.success(res)
        this.updateMenu = false
        this.updateLoading = false
        // this.updateName = ''
        // this.$emit('updated')
      })
    }
  }
}
</script>
<style scoped>
</style>
